<!--后台页-->
<template>
  <el-container>
    <el-aside width="200px">
      <SideMenu></SideMenu>
    </el-aside>
    <el-container>
      <el-header>
        <strong style="color: white;font-size: 18px">良医智慧屏后台管理系统</strong>
        <div class="userShow">
          <!--                    <el-avatar size="medium" :src="userInfo.avatar"></el-avatar>-->
          <el-dropdown>
                        <span class="el-dropdown-link">
                            {{ userInfo.name }}
                            <i class="el-icon-arrow-down el-icon--right"></i>
                        </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>
                <router-link to="/sys/personalCenter">
                  个人中心
                </router-link>
              </el-dropdown-item>
              <el-dropdown-item @click.native="exit">退出</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <el-link href="http://www.lyly360.com/hy-mic-sy/login.html" target="_blank">官方网站</el-link>
        </div>
      </el-header>
      <el-main>
        <tabs></tabs>
        <div style="margin: 0 15px">
          <router-view/>
        </div>

      </el-main>
    </el-container>
  </el-container>
</template>

<script>

import SideMenu from "./inc/SideMenu";
import Tabs from "@/views/inc/Tabs";

export default {
  name: "Home",
  components: {
    SideMenu,
    Tabs
  },
  data() {
    return {
      userInfo: {
        id: "",
        name: "",
        userName: "",
      }
    }
  },
  methods: {
    //获取用户信息
    getUserInfo() {
      this.$axios.get("/user/getUserInfo").then(res => {
        this.userInfo = res.data.data
      })
    },
    //退出登录，清除登录信息
    exit() {
      this.$axios.get("/exit").then(res => {
        localStorage.clear()
        sessionStorage.clear()
        this.$store.commit("resetState")
        this.$router.push("/login")
      })
    }
  },
  //初始化
  created() {
    this.getUserInfo()
  }
}

</script>

<style scoped>
.el-dropdown-link {
  cursor: pointer;
  color: white;
  margin-left: 100px;
}

.el-link {
  color: white;
}


.userShow {
  float: right;
  width: 300px;
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.el-container {
  padding: 0;
  margin: 0;
  height: 100%;
}

.el-header {
  background-color: #17b3A3;
  color: #333;
  text-align: center;
  line-height: 60px;
}

.el-aside {
  background-color: #D3DCE6;
  color: #333;
  line-height: 200px;
}

.el-main {
  color: #333;
  /*text-align: center;*/
  line-height: 40px;
  padding: 0;
}

a {
  text-decoration: none;
}
</style>